/**
 * related to neighborShopCell.ui
 * 
 * @Author : chenglm
 * @Timestamp : 2016-12-26
 */
var root=ui("$");
var helperOpen = require("helper/open");
var button_into = ui("button_into");
var label_shopName = ui("label_shopName");
var alImg01 = ui("alImg01");
var alImg02 = ui("alImg02");
var alImg03 = ui("alImg03");
var do_ALayout_3 = ui("do_ALayout_3");
var do_ALayout_7 = ui("do_ALayout_7");
var do_ALayout_8 = ui("do_ALayout_8");
var productId1;
var productId2;
var productId3;
root.setMapping({
	"imageView_logo.source":"fullLogo",
	"label_shopName.text":"name",
	"label_shopResume.text":"resume",
	"label_shopName.tag":"mallProductVoList",
	"button_into.tag":"id"
});
root.on("dataRefreshed", function(){
	var allData = JSON.parse(label_shopName.tag);
	if (allData[0].firstImg) {
		alImg01.source = allData[0].firstImg;
		productId1 = allData[0].id;
	} else {
		alImg01.source = 'source://image/shop/395.png';
		productId1 = null;
	}
	if (allData[1].firstImg) {
		alImg02.source = allData[1].firstImg;
		productId2 = allData[1].id;
	} else {
		alImg02.source = 'source://image/shop/395.png';
		productId2 = null;
	}
	if (allData[2].firstImg) {
		alImg03.source = allData[2].firstImg;
		productId3 = allData[2].id;
	} else {
		alImg03.source = 'source://image/shop/395.png';
		productId3 = null;
	}
});
button_into.on("touch", "", 300, function(data, e) {
	helperOpen.open("source://view/qshop/detail/main.ui",{shopId:button_into.tag});
});

do_ALayout_3.on("touch", "", 300, function(data, e) {
	if (productId1 != null && productId1 != '') {
		helperOpen.open("source://view/mall/product/main.ui",{"id":productId1,"fromPage":"qshop"});
	}
});

do_ALayout_7.on("touch", "", 300, function(data, e) {
	if (productId2 != null && productId2 != '') {
		helperOpen.open("source://view/mall/product/main.ui",{"id":productId2,"fromPage":"qshop"});
	}
});

do_ALayout_8.on("touch", "", 300, function(data, e) {
	if (productId3 != null && productId3 != '') {
		helperOpen.open("source://view/mall/product/main.ui",{"id":productId3,"fromPage":"qshop"});
	}
});
